<!doctype html>
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
  <head>
    <title></title>
    <meta charset="UTF-8">
    <script src="../webcomponents-loader.js"></script>
    <script src="../../web-component-tester/browser.js"></script>
  </head>
  <body>
    <x-foo></x-foo>
    <script>
      test('ce-import', function(done) {
        var xfoo = document.querySelector('x-foo');
        assert.isUndefined(xfoo.isCreated);

        var link = document.createElement('link');
        link.rel = 'import';
        link.href = 'imports/element-import.html';
        document.head.appendChild(link);
        link.addEventListener('load', function() {
          assert.isTrue(xfoo.isCreated, 'element in main document, registered in dynamic import is upgraded');
          var ix = link.import.querySelector('x-foo');
          assert.isTrue(ix.isCreated, 'element in import, registered in dynamic import is upgraded');
          done();
        });
      });
    </script>
  </body>
</html>
